#include<bits/stdc++.h>
using namespace std;

int a[10005];

signed main() {
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}

	int ans = 0;
	for (int i = 1; i < n; i++) {
		for (int j = 1; j < n; j++) {
			if (a[j] > a[j + 1]) {
				swap(a[j], a[j + 1]);
				ans++;
			}
		}
	}
	cout << ans;
	return 0;
}
